package fjut.acm.coding.service.test;

import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

@Service
public class ThreadTestServiceImpl {

    /**
     * 异步申明
     * 异步方法的线程由线程池来影响，此处已经通过验证
     */
    @Async
    public void test1(){
        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("当前线程："+Thread.currentThread().getName());
    }


    public void test2(){
        System.out.println("当前线程："+Thread.currentThread().getName());
    }

}
